const { Category } = require('../../model/Category');
module.exports = async (req,res)=>{
  let category = await Category.findOne({_id: req.query.id});
  if (category){
    await Category.findByIdAndDelete(req.query.id);
    res.redirect('/admin/categories');
  }
}